<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">

    <h:head>
        <title>MeteoCal - #{uBean.actualLoggedUser.username}'s profile</title>
        <link href="../css/application.css" rel="stylesheet"></link>
        <link rel="icon" type="image/ico" href="../images/logoico.ico"/>
    </h:head>
    #{nBean.WeatherNotificationCreator(uBean.actualLoggedUser.username)}
    <h:body><div id="body">

            <div id="head">
                <a href=""><img src="../images/logo.png" /></a>

                <h:form><p:commandLink action="#{loginBean.logout()}">
                        <p:graphicImage value="../images/logout.png" style="width: 70px; top:140px; left:88%;"/>
                    </p:commandLink></h:form>
            </div>

            <div id="title">
                <p1>MeteoCal</p1><br />
                <p2>Your website to plan your events.</p2>
            </div>

            <div id="bar">
                <a href="personalpage.xhtml" id="ppage" >#{uBean.actualLoggedUser.username} 's MeteoCal</a>
                <a href="calendar.xhtml" id="calendar">Calendar</a>
                <a href="search.xhtml" id="search">Search MeteoCal's friends</a>
            </div>

            <div id="profile">
                <b>Username:</b><br />
                #{uBean.actualLoggedUser.username}
                <br /><br />
                <b>Name:</b><br />
                #{uBean.actualLoggedUser.name}
                <br /><br />
                <b>Surname:</b><br />
                #{uBean.actualLoggedUser.surname}
                <br /><br />
                <b>Email:</b><br />
                #{uBean.actualLoggedUser.email}
                <br /><br />
                <b>Privacy:</b><br />
                <h:outputText value="Private" rendered="#{uBean.privCal(uBean.actualLoggedUser.username)}"/>
                <h:outputText value="Public" rendered="#{uBean.pubCal(uBean.actualLoggedUser.username)}"/>
                <br /><br />
                <p:button value="Modify account" href="accountmodification.xhtml" style="border:0; box-shadow:0px 2px 5px #000000;" />
                <br /><br /><br />
            </div>

            <div id="eventlist">
                <b style="font-weight: bold; text-shadow: 0px 2px 5px #000000; font-size: 160%; color:red;">Your future events</b>
                <br /><br />
                <h:form rendered="#{uBean.thereAreEvents(uBean.actualLoggedUser.username)}">
                <ui:repeat value="#{eBean.allEvents(uBean.actualLoggedUser.username)}" var="event" >
                   
                    <h:panelGroup layout= "block" styleClass="blue_boxed" rendered="#{eBean.isOrganizer(uBean.actualLoggedUser.username, event)}">
                        <li><h:link value="#{event.title}" outcome="event"  
                                                         style="list-style: none; font-weight: bold;">
                                <f:param name="id" value="#{event.id}" />
                            </h:link>
                            <br />
                            #{event.city} - on #{eBean.stringDate(event.id)} <br />
                            from #{event.stringBH()} to #{event.stringEH()}
                        </li>
                    </h:panelGroup>

                     <h:panelGroup layout= "block" styleClass="green_boxed" rendered="#{eBean.uJoins(uBean.actualLoggedUser, event)}">
                         <li><h:link value="#{event.title}" outcome="event"  
                                                         style="list-style: none; font-weight: bold;">
                                <f:param name="id" value="#{event.id}" />
                            </h:link>
                            <br />
                            #{event.city} - on #{eBean.stringDate(event.id)} <br />
                            from #{event.stringBH()} to #{event.stringEH()}</li>
                     </h:panelGroup>
                    

                    <h:panelGroup layout= "block" styleClass="red_boxed" rendered="#{eBean.uNotJoins(uBean.actualLoggedUser, event)}">
                         <li><h:link value="#{event.title}" outcome="event"
                                                         style="list-style: none; font-weight: bold;">
                                <f:param name="id" value="#{event.id}" />
                            </h:link>
                            <br />
                            #{event.city} - on #{eBean.stringDate(event.id)} <br />
                            from #{event.stringBH()} to #{event.stringEH()}</li>
                    </h:panelGroup>
                   
                    <br />
                </ui:repeat>
                </h:form>
                <h:outputText value="There are no scheduled events" rendered="#{uBean.thereAreNoEvents(uBean.actualLoggedUser.username)}"/>
            </div>
            <br /><br />
            
            <div id="notification_box">
                <h:panelGrid columns="1">
                    <h:form style=" max-height: 200px; overflow-y: scroll; -ms-overflow-style: none;" class="notify">
                        <b>Invites</b><br />
                        <ui:repeat value="#{nBean.inviteNotificationList(uBean.actualLoggedUser.username)}" var="notify" rendered="#{nBean.cisonoInot(uBean.actualLoggedUser)}">
                    <li><h:link value="#{notify.invite.event.title}" outcome="invite" style="list-style: none;" >
                            <f:param name="id" value="#{notify.invite.id}" />
                        </h:link>
                    </li>
                </ui:repeat>
                        <h:outputText value="No notifications" rendered="#{nBean.noncisonoInot(uBean.actualLoggedUser)}" />
                </h:form>
                    <p:separator style="width: 242px;"/>

                    <h:form style=" max-height: 200px; overflow-y: scroll; -ms-overflow-style: none;"  class="notify">
                        <b>Weather alerts</b> <br />
                    <ui:repeat value="#{nBean.weatherNotificationList(uBean.actualLoggedUser.username)}" var="notify" rendered="#{nBean.cisonoWnot(uBean.actualLoggedUser)}">
                    <li><h:link value="#{notify.event.title}" outcome="event" style="list-style: none;">
                            <f:param name="id" value="#{notify.event.id}" />
                        </h:link>
                    </li>
                </ui:repeat>
                        <h:outputText value="No notifications" rendered="#{nBean.noncisonoWnot(uBean.actualLoggedUser)}" />
                        </h:form>
                    <p:separator style="width: 242px;"/>

                    <h:form style=" max-height: 200px; overflow-y: scroll; -ms-overflow-style: none;" class="notify">
                        <b>Modifications</b> <br />
                    <ui:repeat value="#{nBean.modificationNotificationList(uBean.actualLoggedUser.username)}" var="notify" rendered="#{nBean.cisonoMnot(uBean.actualLoggedUser)}">
                    <li><h:link value="#{notify.event.title}" outcome="event" style="list-style: none;">
                            <f:param name="id" value="#{notify.event.id}" />
                        </h:link>
                    </li>
                </ui:repeat>
                        <h:outputText value="No notifications" rendered="#{nBean.noncisonoMnot(uBean.actualLoggedUser)}" />
                        </h:form>
                </h:panelGrid>
                
                
            </div>
            <div id="addevent"><a href="eventCreation.xhtml" title="Add a new event!"><img src="../images/add.png" /></a></div>

        </div>      
    </h:body>
</html>
